def cal(a,b):
    print(f"{a}*{b}={a*b}", end = " ")

for i in range (1,10):
    for k in range(1,10-i):
        print("   ", end="")
    for j in range(1,i+1):
        print(f"{i}*{j}={i*j}",end = " ")
    print(" ")

    i=1
j=1
k=0
while (i<10):
    while (j<=i):
        while(k<(24-(i-1)*3)):
            print(" ",end="")
            k=k+1
        print("{}*{}={}".format(j,i,i*j),end=" ")
        j=j+1
    print("\n")
    j=1
    i=i+1
    k=0

#课后练习打印日历
month_dict = {1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June',
              7: 'July', 8: 'August', 9: 'September', 10: 'October', 11: 'November', 12: 'December'}

def getdays(month):
    if month in (1, 3, 5, 7, 8, 10, 12):
        return 31
    elif month in (4, 6, 9, 11):
        return 30
    else:
        return 28

def get_first_day(month):
    if(month==1):
        return 5
    else:
        days=0
        for m in range(1, month):
            days += getdays(m)
        return (5 + days) % 7

def print_month(month):
    print ('         ', month_dict[month], '   ')
    print ('-------------------------------------')
    print ('  Mon  Tue  Wed  Thu  Fri  Sat  Sun  ')
    i = get_first_day(month)-1

    if i != 7:
        print ('     ' * i,end="")

    for j in range(1, getdays(month)+1):
        print ('%4d' %j,end=" ")
        i += 1
        if i % 7 == 0:
            print (' ') 


n=1
while(n<=12):
    print_month(n)
    print("\n")
    n+=1
```
![image](2.png)